<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="vue.js"></script>
  </head>
  <body>
    <div id="root">
      <child content="hello world" :arg="1111" :arg2="123456"></child>
    </div>
    <script>
      Vue.component('child', {
        props: {
          //子组件接受的content参数验证
          content: [String, Number],
          //子组件接受的arg参数验证
          arg: {
            type: Number, //整形
            redirect: true, //非必传
            default: '222' //如果没传则赋默认值
          },
          //子组件接受的ar2参数验证
          arg2: {
            type: Number //整形
            // validator: function(value) {
            //   //长度大于5
            //   return value.length > 5;
            // }
          }
        },
        template: '<div>{{content}}</div>'
      });

      new Vue({
        el: '#root'
      });
    </script>
  </body>
</html>
